﻿@using Volo.Abp.AspNetCore.Components.Web
@using EasyAbp.AbpHelper.Gui.Localization
@using EasyAbp.AbpHelper.Gui.CodeGeneration.AppService.Dtos;
@using EasyAbp.AbpHelper.Gui.Blazor.Pages.Shared;
@inherits ExecutableComponentBaseWithDirectory<AbpHelperGenerateAppServiceMethodsInput>
@inject AbpBlazorMessageLocalizerHelper<GuiResource> Lh

<Card Class="mb-4">
    <CardBody>
        <Alert Color="Color.Info"  Visible>
            <AlertDescription>
                <Icon Name="IconName.QuestionCircle" /> @L["Info:FunctionIsBasedOnAbpHelperPart1"]
            </AlertDescription>
            <AlertMessage>
                <Icon Name="IconName.ExternalLinkSquareAlt"/>
                <Link To="https://github.com/EasyAbp/AbpHelper.CLI/blob/develop/src/AbpHelper.Core/Commands/Generate/Methods/MethodsCommandOption.cs" Target="Target.Blank" Style="text-decoration: none">
                    @L["Info:FunctionIsBasedOnAbpHelperPart2_SourceCode"]
                </Link>
            </AlertMessage>
            <AlertDescription>
                @L["Info:FunctionIsBasedOnAbpHelperPart3"]
            </AlertDescription>
        </Alert>
        <Form>
            <Validations @ref="ValidationsRef" Model="Input" ValidateOnLoad="false">
                <Validation MessageLocalizer="@Lh.Localize">
                    <Field>
                        <FieldLabel>@L["Directory"]</FieldLabel>
                        <TextEdit @bind-Text="Input.Directory" Autofocus="true">
                            <Feedback>
                                <ValidationError/>
                            </Feedback>
                        </TextEdit>
                    </Field>
                </Validation>
                <Validation MessageLocalizer="@Lh.Localize">
                    <Field>
                        <FieldLabel>@L["CodeGeneration_AppService:MethodNames"]</FieldLabel>
                        <TextEdit @bind-Text="Input.MethodNames" Placeholder="e.g. Create Update Delete">
                            <Feedback>
                                <ValidationError/>
                            </Feedback>
                        </TextEdit>
                    </Field>
                </Validation>
                <Validation MessageLocalizer="@Lh.Localize">
                    <Field>
                        <FieldLabel>@L["CodeGeneration_AppService:ServiceName"]</FieldLabel>
                        <TextEdit @bind-Text="Input.ServiceName" Placeholder="e.g. Product">
                            <Feedback>
                                <ValidationError/>
                            </Feedback>
                        </TextEdit>
                    </Field>
                </Validation>
                <Field>
                    <Check TValue="bool" @bind-Checked="@Input.IntegrationService">@L["CodeGeneration_AppService:IntegrationService"]</Check>
                </Field>
                <Field>
                    <Check TValue="bool" @bind-Checked="@Input.NoInput">@L["CodeGeneration_AppService:NoInput"]</Check>
                </Field>
                <Field>
                    <Check TValue="bool" @bind-Checked="@Input.NoOutput">@L["CodeGeneration_AppService:NoOutput"]</Check>
                </Field>
                <Field>
                    <Check TValue="bool" @bind-Checked="@Input.NoOverwrite">@L["NoOverwrite"]</Check>
                </Field>
                <Validation MessageLocalizer="@Lh.Localize">
                    <Field>
                        <FieldLabel>@L["ProjectName"]</FieldLabel>
                        <TextEdit @bind-Text="Input.ProjectName">
                            <Feedback>
                                <ValidationError/>
                            </Feedback>
                        </TextEdit>
                    </Field>
                </Validation>
                <Validation MessageLocalizer="@Lh.Localize">
                    <Field>
                        <FieldLabel>@L["Exclude"]</FieldLabel>
                        <TextEdit @bind-Text="Input.Exclude">
                            <Feedback>
                                <ValidationError/>
                            </Feedback>
                        </TextEdit>
                    </Field>
                </Validation>

                <SubmitButton Block="true" Clicked="@ExecuteAsync" SaveResourceKey="Button:Execute" />
            </Validations>
        </Form>
    </CardBody>
</Card>